import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: () => import("../views/Layout/index.vue"),
  },

  {
    path: "/layout",
    name: "layout",
    meta: {
      isLogin: true,
    },
    component: () => import("../views/Layout/index.vue"),
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("../views/Home/index.vue"),
      },
      {
        path: "goods",
        name: "goods",
        component: () => import("../views/Goods/Goods.vue"),
      },
      {
        path: "addgoods",
        name: "addgoods",
        component: () => import("../views/Goods/AddGods.vue"),
      },
      {
        path: "order",
        name: "order",
        redirect: " order/orderlist",
        component: () => import("../views/Oreder/index.vue"),
        children: [
          {
            path: "orderlist",
            name: "orderlist",
            component: () => import("../views/Oreder/OrderList/index.vue"),
          },
          {
            path: "orderback",
            name: "orderback",
            component: () => import("../views/Oreder/OrderBack/index.vue"),
          },
        ],
      },
      {
        path: "advert",
        name: "advert",
        component: () => import("../views/Advert/Advert.vue"),
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('../views/User/index.vue'),
      },

      {
        path: "params",
        name: "params",
        component: () => import("../views/Params/Params.vue"),
        redirect: "params/Specification",
        children: [
          {
            path: "Specification",
            name: "Specification",
            component: () =>
              import("../views/Params/paramsInfo/Specification.vue"),
          },
        ],
      },
    ],
  },
  {
    path: "/login",
    name: "login",

    component: () => import("../views/Login/Login.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
